﻿
@{
    ViewBag.Title = "NoticeDetail";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css{

    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/summernote/summernote.css" rel="stylesheet" />

    <style>
        .required {
            color: red;
        }
    </style>
}

<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a>编辑通知公告</a>
            </li>
            <li class="crumb-link">
                <a>通知公告</a>
            </li>
            <li class="crumb-trail">编辑通知公告</li>
        </ol>
    </div>
</header>
<div id="content" ng-cloak ng-controller="NoticeController" ng-init="DataLoading=false;LoadingMsg='正在导入...';page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     Id='@(Request.QueryString["Id"].IsEmpty() ? "" : Request.QueryString["Id"])';
     AddModel={};
     GetNoticeType();
     ImageCount=[0,1,2,3,4]; InitImgeUpload3();ImageList=[];
     GetNoticeDetail(Id,true);
">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		</svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-info panel-border top mb35">
                <div class="panel-heading">
                    <span class="panel-title">编辑通知公告</span>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form">

                        <div class="form-group">
                            <label class="col-lg-2 control-label">公告类型</label>
                            <div class="col-lg-8">
                                <select class="form-control" ng-model="NoticeDetail.NoticeType">
                                    <option value="" selected>请选择通知公告类型...</option>
                                    <option ng-repeat="x in NoticeTypeList" value="{{x.Id}}">{{x.TypeName}}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">发布日期</label>
                            <div class="col-sm-8">
                                <datepicker id="startTime" option="datetimeOption" format="L" ng-model="NoticeDetail.PublishTime"></datepicker>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">标题</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="NoticeDetail.NoticeTitle" placeholder="此处输入标题" maxlength="50" />
                            </div>
                            <label class="control-label">{{NoticeDetail.NoticeTitle.length}}/50</label>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">正文</label>
                            <div class="col-sm-8">
                                <div class="summernote" id="noticecontent">

                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">图片</label>
                            <div class="col-sm-8">
                                <div class="col-sm-1" ng-repeat="x in ImageCount" id="imagebox_{{x}}" style="margin-right:20px;margin-left:10px;">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">视频文件</label>
                            <div class="col-lg-8">
                                <input type="file" ngf-select name="files" id="videofiles" class="file" initialPreviewAsData="true" data-show-remove="true" data-show-preview="true" showCancel="false" data-show-upload="false" accept="video/*" multiple>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">通知附件</label>
                            <div class="col-lg-8">
                                <input type="file" ngf-select ng-model="doc.Files" name="docfiles" id="docfiles" class="file" initialPreviewAsData="true" data-show-remove="true" data-show-preview="true" showCancel="false" data-show-upload="false">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">已上传图片</label>
                            <div class="col-lg-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="NoticeDetail.ImageList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in NoticeDetail.ImageList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeleteNoticeFile(x.FileId,NoticeDetail.ImageList)" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">已上传视频</label>
                            <div class="col-lg-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="NoticeDetail.VideoList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in NoticeDetail.VideoList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeleteNoticeFile(x.FileId,NoticeDetail.VideoList)" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputStandard" class="col-lg-2 control-label">已上传附件</label>
                            <div class="col-lg-8">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th style="width:5%">序号</th>
                                            <th style="width:30%">文件名称</th>
                                            <th style="width:10%">文件大小(kb)</th>
                                            <th style="width:10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr ng-show="NoticeDetail.FileList.length==0">
                                            <td colspan="4" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                        </tr>
                                        <tr ng-repeat="x in NoticeDetail.FileList">
                                            <td ng-bind="$index+1"></td>
                                            <td ng-bind="x.FileName"></td>
                                            <td ng-bind="x.FileSize"></td>
                                            <td>
                                                <a href="../Download/DownloadFile?FileId={{x.FileId}}" class="btn btn-success btn-xs btn-label"><i class="fa fa-download"></i>下载</a>
                                                <a ng-click="DeleteNoticeFile(x.FileId,NoticeDetail.FileList)" class="btn btn-danger btn-xs btn-label"><i class="fa fa-trash-o"></i>删除</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                    </form>
                </div>
                <div class="panel-footer">
                    <button type="button" class="btn btn-success" ng-click="EditNotice(NoticeDetail,1,page);">发布</button>
                    <div class="col-lg-2"></div>
                    <button type="button" class="btn btn-primary" ng-click="EditNotice(NoticeDetail,0,page);">保存</button>
                    <div class="col-lg-2"></div>
                    <button type="button" class="btn btn-warning">重置页面</button>
                </div>
            </div>
        </div>
    </div>

</div>
@section Js{
    <script src="~/Bussiness/js/libs/upload.js"></script>
    <script src="~/Bussiness/js/pg/Notice.js?v=@DateTime.Now.ToString("yyMMddHHmm")"></script>
    <script src="~/Bussiness/js/libs/moment.min.js"></script>
    <script src="~/Bussiness/js/libs/locales/date/zh-cn.js"></script>
    <script src="~/Bussiness/js/libs/bootstrap-datetimepicker.min.js"></script>
    <script src="~/Bussiness/js/libs/angularjs-datepicker.js"></script>
    <script src="~/Bussiness/js/libs/fileinput.js"></script>
    <script src="~/Bussiness/js/libs/zh.js"></script>
    <script src="~/Assets/summernote/summernote.min.js"></script>
    <script src="~/Assets/summernote/summernote-zh-CN.js"></script>

    <script>
        $('.summernote').summernote({
            height: 255, //set editable area's height
            focus: false, //set focus editable area after Initialize summernote
            oninit: function () { },
            onChange: function (contents, $editable) { },
            lang: 'zh-CN'
        });
        $('#docfiles').fileinput({
            language: 'zh'
        });
        $('#videofiles').fileinput({
            language: 'zh'
        });
    </script>
}
